package edu.ntu.im.p2ptrade.msg.handle;

import edu.ntu.im.p2ptrade.LockManager;
import edu.ntu.im.p2ptrade.P2PTrade;
import edu.ntu.im.p2ptrade.TransactionManager;
import edu.ntu.im.p2ptrade.msg.PMessage;
import net.jxta.endpoint.Message;

public class CanCommitHandle implements PMessageHandle {

	public void handle(Message msg) {
		String transactionId = msg.getMessageElement(P2PTrade.getInstance().getAppName(), PMessage.TRANSACTIONID).toString();
		String peer = msg.getMessageElement(P2PTrade.getInstance().getAppName(), PMessage.PEER).toString();
		TransactionManager.getInstance().ifCommit = new TransactionManager.CommitInfo(transactionId, peer);
	}
}
